package logic

import (
	"context"
	"strconv"
	"test-demo/model"

	"test-demo/user_srv/internal/svc"
	"test-demo/user_srv/user"

	"github.com/zeromicro/go-zero/core/logx"
)

type RealTestLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewRealTestLogic(ctx context.Context, svcCtx *svc.ServiceContext) *RealTestLogic {
	return &RealTestLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *RealTestLogic) RealTest(in *user.RealRequest) (*user.Response, error) {
	// todo: add your logic here and delete this line
	re := model.RealTest(int(in.Userid), in.Realname, in.Idcode)
	_, err := strconv.Atoi(re)
	if err != nil {
		return &user.Response{
			Status: re,
		}, nil
	}
	return &user.Response{
		Status: "1",
	}, nil
}
